# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=rtpbreak
pkgver=1.3a
pkgrel=3
epoch=1
groups=('blackarch' 'blackarch-networking')
pkgdesc='Detects, reconstructs and analyzes any RTP session.'
url='https://packetstorm.news/files/id/66494/'
license=('GPL-2.0-or-later')
depends=('libpcap' 'libnet')
arch=('x86_64' 'aarch64')
source=("https://dl.packetstormsecurity.com/sniffers/$pkgname-$pkgver.tgz"
        "add-missing-debug-flag.patch"
        "add-missing-include.patch"
        "fix-format-security.patch")
DLAGENTS=("https::/usr/bin/curl -k -o %o %u")
sha512sums=('abe0329f91a8c76d4fab5589d834e19615457fe1c5cdb410ce2f6fbf871b750cf917a92a979b92aaf5f0a2644fa4f4dc4ca7e53fb46d71c8fa016a7f41efe5ad'
            '2a735b266f517c9d7ac92ec50da6723e5c0e9596a27d986feb2e915c1bd921e2271f7a661f2e8c7741511b8236dba6c1be2cdf5ba5574457d94652c708ea4505'
            '7e3a2d787cc14e144d88775ee061ea31a825946b1f029cfed178bf6ebd6ca1bf40b33c3296df6b17194c30ae0e66f391f9a0a4430dadb1b9605b2aecb0815f4a'
            '5408676122ac94f736858274c7158c53ae599cff9c2ea6d1b90de50f6049954f96b7c9b0306f6b1775d2c2c426e8a0ba0384e05873eb25d363d148161e0b3bc6')

prepare() {
  cd "$pkgname-$pkgver"

  patch -p1 < ../add-missing-debug-flag.patch
  patch -p1 < ../add-missing-include.patch
  patch -p1 < ../fix-format-security.patch
}

build() {
  cd "$pkgname-$pkgver"

  make CFLAGS="$CFLAGS"
}

package() {
  cd "$pkgname-$pkgver"

  install -Dm 755 "src/$pkgname" "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" doc/*
}

